<?php
class database extends PDO {

	public function __construct($driver, $hostname, $username, $password, $database) {
   
        if($driver == 'mysql') {
            parent::__construct($driver . ':host=' . $hostname . ';dbname=' . $database . ';charset=UTF8', $username, $password,
                array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            $this->exec("SET SQL_MODE=ANSI_QUOTES");
        } else {
             parent::__construct($driver . ':host=' . $hostname . ';dbname=' . $database, $username, $password);
        }
    
        $this->exec("SET CHARACTER SET utf8");
        $this->exec("SEN NAMES 'utf8';");
        $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 
    }

}
